package boundarys;

import java.awt.EventQueue;

import javax.swing.JFrame;
import javax.swing.JButton;

import ccrm.BoundryControl;

import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;

public class ManageProductCategoryTypeGUI extends AbstractGUI {

	/**
	 * ManageProductCategoryTypeGUI frame
	 */
	private JFrame frmCcrmmanageProductCategoryType;


	/**
	 * Constructor
	 */
	public ManageProductCategoryTypeGUI() {
		initialize();
		initGUI(frmCcrmmanageProductCategoryType);
		frmCcrmmanageProductCategoryType.getContentPane().setLayout(null);
		
		JButton ManageCategoryBtn = new JButton("Manage Categories");

		/**
		 * Action Listener for Manage Category Button
		 * disposes current frame and opens ManageCategoriesGUI frame
		 */
		ManageCategoryBtn.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent arg0) {
				if(BoundryControl.GUIArr.size()==getIndex()+1)
				{
					frmCcrmmanageProductCategoryType.dispose();
					new ManageCategoriesGUI();
				}
			}
		});
		ManageCategoryBtn.setBounds(61, 41, 234, 50);
		frmCcrmmanageProductCategoryType.getContentPane().add(ManageCategoryBtn);
		
		JButton ManageTypeBtn = new JButton("Manage Types");
		/**
		 * Action Listener for Manage Type Button
		 * disposes current frame and opens ManageTypesGUI frame
		 */
		ManageTypeBtn.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				if(BoundryControl.GUIArr.size()==getIndex()+1)
				{
					frmCcrmmanageProductCategoryType.dispose();
					new ManageTypesGUI();
				}
			}
		});
		ManageTypeBtn.setBounds(61, 102, 234, 50);
		frmCcrmmanageProductCategoryType.getContentPane().add(ManageTypeBtn);
		
		JButton AssociateProductBtn = new JButton("Associate Product");
		/**
		 * Action Listener for Associate Product Button
		 * disposes current frame and opens AssociateProductGUI frame
		 */
		AssociateProductBtn.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				if(BoundryControl.GUIArr.size()==getIndex()+1)
				{
					frmCcrmmanageProductCategoryType.dispose();
					new AssociateProductGUI();
				}
			}
		});
		AssociateProductBtn.setBounds(61, 163, 234, 50);
		frmCcrmmanageProductCategoryType.getContentPane().add(AssociateProductBtn);
	}

	/**
	 * Initialize the contents of the frame.
	 */
	private void initialize() {
		frmCcrmmanageProductCategoryType = new JFrame();
		frmCcrmmanageProductCategoryType.setTitle("CCRM>Manage Product Category/Type");
		frmCcrmmanageProductCategoryType.setResizable(false);
		frmCcrmmanageProductCategoryType.setBounds(100, 100, 365, 304);
		frmCcrmmanageProductCategoryType.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
		frmCcrmmanageProductCategoryType.setVisible(true);
	}

	@Override
	public void getReply(Object r) {
		// TODO Auto-generated method stub
		
	}
}
